package com.user.controller;

import org.springframework.beans.factory.annotation.Value;
import org.springframework.cloud.context.config.annotation.RefreshScope;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RestController;

/**
 * @author:wesley
 */
@RefreshScope
@RestController
public class UserConfigController {

    @Value("${from}")
    private String from;


    @Value("${spring.datasource.driverClassName}")
    private String driverClassName;

    @Value("${spring.datasource.url}")
    private String url;

    @Value("${spring.datasource.username}")
    private String username;

    @Value("${spring.datasource.password}")
    private String password;


    @GetMapping(value = "/from")
    public String getFrom(){
        return  from;
    }


    /**
     *
     * 在controller访问中是没有问题的。
     *
     * @return
     */
    @GetMapping(value = "/db/config")
    public String getDBConfig(){
        return driverClassName + "-" + url +"-"+username +"-"+password;
    }

}
